package com.project.platform.service.impl;

import com.project.platform.entity.MedicationRecord;
import com.project.platform.mapper.MedicationRecordMapper;
import com.project.platform.service.MedicationRecordService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import com.project.platform.vo.PageVO;

import java.util.List;
import java.util.Map;

/**
 * ${table.name}
 */
@Service
public class MedicationRecordServiceImpl  implements MedicationRecordService {
    @Resource
    private MedicationRecordMapper medicationRecordMapper;
    
    @Override
    public PageVO<MedicationRecord> page(Map<String, Object> query, Integer pageNum, Integer pageSize) {
        PageVO<MedicationRecord> page = new PageVO();
        List<MedicationRecord> list = medicationRecordMapper.queryPage((pageNum - 1) * pageSize, pageSize, query);
        page.setList(list);
        page.setTotal(medicationRecordMapper.queryCount(query));
        return page;
    }

    @Override
    public MedicationRecord selectById(Integer id) {
        MedicationRecord medicationRecord = medicationRecordMapper.selectById(id);
        return medicationRecord;
    }

    @Override
    public List<MedicationRecord> list() {
        return medicationRecordMapper.list();
    }
    @Override
    public void insert(MedicationRecord entity) {
        check(entity);
        medicationRecordMapper.insert(entity);
    }
    @Override
    public void updateById(MedicationRecord entity) {
        check(entity);
        medicationRecordMapper.updateById(entity);
    }
    private void check(MedicationRecord entity) {

    }
    @Override
    public void removeByIds(List<Integer> ids) {
        medicationRecordMapper.removeByIds(ids);
    }
}
